<template>
	<view>
		<view class="u-card-box u-m-b-20" v-for="(item,index) in list" :key="item.user.id">
			<view class="u-flex u-row-between" :class="item.check == true ? 'u-m-b-20' : ''">
				<view class="u-flex-1 u-flex u-row-between">
					<u-image width="130rpx" height="130rpx" :src="item.user.head_img"></u-image>
					<view class="u-flex-1 u-flex u-row-between u-m-l-20" style="height: 130rpx;">
						<view class="u-flex-col u-row-between u-height-100">
							<view class="u-font-28 u-font-bold">{{item.user.name}}</view>
							<!-- <view class="u-flex u-ellipsis" @click="checkLabel(item)">
								<view class="u-m-r-10 u-font-22 u-color-blue u-border-blue u-radius-20 u-tag-box" v-if="!item.isLabel" >选择标签</view>
								<view class="u-m-r-10 u-font-22 u-color-blue u-border-blue u-radius-20 u-tag-box" v-for="(tagItem,tagIndex) in item.label" :key="tagIndex" v-else>
								    {{tagItem}}
								</view>
							</view> -->
							<view class="u-font-24 u-color-puce">能量值：{{item.user.number}}</view>
						</view>
					</view>
				</view>
				<view>
					<view class="u-square-tag u-back-red" v-if="[0].includes(item.isEvaluate)" @click="openRate(item)">待评价</view>
					<view class="u-square-tag u-back-gray" v-else>已评价</view>
				</view>
			</view>
			
			<view class="u-border-top u-p-t-30" v-if="item.check == true">
				<view class="u-m-b-10 u-flex u-row-between" v-for="optionItem in item.optionList" :key="optionItem.id">
					<view>{{ optionItem.name }}</view>
					<view>
						<u-rate active-icon="thumb-up-fill" inactive-icon="thumb-up" active-color="#FCA40D" :count="5" size="44" :disabled="item.isEvaluate == 1 ? true : false" v-model="optionItem.number"></u-rate>
					</view>
				</view>
				<view class="u-m-t-20">
					<u-input placeholder="请输入您的一句话评价" :custom-style="inputStyle" height="60" :clearable="false" :disabled="item.isEvaluate == 1 ? true : false" v-model="item.content"></u-input>
				</view>
			</view>
		</view>
		<view class="u-form-box" v-if="type == 1">
			<u-form>
				<u-form-item required label="上传酒局照片" label-position="top">
					<view class="u-flex">
						<u-upload :action="action" :deletable="false" :show-progress="false" max-count="4" image-mode="widthFix"
							width="120" height="120" @on-success="onSuccess"
							@on-remove="onRemove"></u-upload>
					</view>
				</u-form-item>
			</u-form>
		</view>
		<view class="submit_box">
			<view class="submit_btn" @click="confirm">确定</view>
		</view>
		
	</view>
</template>

<script>
	import env from '@/network/env.js'
	export default{
		props:["list","type"],
		data(){
			return{
				inputStyle:{
					background:'#F2F5FA',
					padding: '5rpx 20rpx',
					borderRadius: '10rpx',
					fontSize: '24rpx'
				},
				action: `${env.baseUrl}/api/uploadOssImage`,
			}
		},
		methods:{
			openRate(val){
				val.check = !val.check
			},
			checkLabel(val){
				if(val.isEvaluate == 0){
					this.$emit("checkLabel",val.user.id)
				}
			},
			confirm(){
				this.$emit("confirm",this.list)
			},
			onSuccess(val){
				this.$emit("onSuccess",val)
			},
			onRemove(val){
				this.$emit("onRemove",val)
			}
		}
	}
</script>

<style lang="scss" scoped>
	.submit_box{
		display: flex;
		justify-content: center;
		margin-top: 50rpx;
		
		.submit_btn{
			padding: 20rpx 0rpx;
			background: #2C76ED;
			color: #fff;
			width: 500rpx;
			text-align: center;
			border-radius: 50rpx;
		}
	}
	
	
</style>